//Funtion: calculate the number of item of array and draw the histogram

#include <iostream>
#include <iomanip>   //setw() head file 
using namespace std;

int main (void)
{
	const int arraySize = 10;
	int a[arraySize] = {1, 8, 3, 4, 9, 6, 12, 8, 9, 10};
	cout << "element" << setw(9) << "number" << setw(12) << "Histogram" << endl;
	for (int i=0; i<arraySize ; i++)
	{
		cout << setw(7) << i << setw(9) << a[i] << setw(4);
		for(int j=0; j<a[i]; j++)
		{
			cout << "*";
		}
		cout << endl;
	}	
	return 0;
}
